package com.caizongzhen.www.controller;

import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Session;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.caizongzhen.www.config.CaiZongZhenInfoConfig;
import com.caizongzhen.www.entity.*;
import com.caizongzhen.www.service.IllnessKindService;
import com.caizongzhen.www.service.IllnessService;
import com.caizongzhen.www.service.MedicineService;
import com.caizongzhen.www.util.Assert;
import com.caizongzhen.www.util.EmailClient;
import com.caizongzhen.www.util.RespResult;
import com.caizongzhen.www.vo.request.FeedBackRequestVo;
import com.caizongzhen.www.vo.response.FeedBackResponseVo;
import com.caizongzhen.www.vo.response.KeyValueResponseVo;
//import com.sun.javafx.collections.MappingChange;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.*;

/*
* @Controller
* 表示该类是一个控制器 MVC中的C层
* 可以处理前端浏览器的请求
* */

@Controller
public class IndexController {
    @Autowired
    private CaiZongZhenInfoConfig caiZongZhenInfoConfig;
    @Autowired
    private MedicineService medicineService;
    @Autowired
    private IllnessService illnessService;
    @Autowired
    private IllnessKindService illnessKindService;
    /*
    * 首页
    * */
    @RequestMapping("/index")
    public String index(Model model, FeedBackRequestVo feedBackRequestVo){

        // 自定义数据类型传参
        FeedBackResponseVo feedBackResponseVo = new FeedBackResponseVo();
        feedBackResponseVo.setName("23311123_蔡宗镇");
        feedBackResponseVo.setAge(20);
        feedBackResponseVo.setEmail("24049855661");
        model.addAttribute("username","23311123_蔡宗镇");
        model.addAttribute("feedBackResponseVo",feedBackResponseVo);
        // Map自定义类型传参
        KeyValueResponseVo<String,String> keyValueResponseVo1 = new KeyValueResponseVo<>();
        keyValueResponseVo1.put("name","王五");
        keyValueResponseVo1.put("age","18");
        keyValueResponseVo1.put("email","123456");
        model.addAllAttributes(keyValueResponseVo1);

        model.addAttribute("caiZongZhenInfoConfig","Id："+caiZongZhenInfoConfig.getId()+"_name："+caiZongZhenInfoConfig.getName()+"_age："+caiZongZhenInfoConfig.getAge());
        return  "index";
    }













}
